<template>
  <div class="search">
    <el-tag class="tag">{{tag}}</el-tag>
    <el-select
      :style="{'width':'200px','width':width,'margin-left':'-7px'}"
      size="small"
      v-model="myValue"
      clearable
      :placeholder="placeholder"
      @change="change"
    >
      <el-option v-for="(item,index) in options" :key="index" :label='item.label' :value="item.value"></el-option>
    </el-select>
  </div>
</template>
<script>
// 下拉框组件
export default {
  name: "select-module",
  props: ["tag", "placeholder", "valueData", "options", "width"],
  data() {
    return {
      myValue: ""
    };
  },
  mounted() {
    this.myValue = this.valueData;
  },
  watch: {
    valueData(val) {
      this.myValue = val;
    }
  },
  methods: {
    change() {
      this.$emit("input", this.myValue);
    }
  }
};
</script>

<style lang='scss' scoped>
.search {
  margin-right: 20px;
  .tag {
    display: inline-block;
    vertical-align: top;
  }
}
.el-tag {
  background: #ffffff;
  border: 1px solid #dcdfe6;
}
</style>